package com.qf.controller;

import com.qf.entity.City;
import com.qf.service.ICtiyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 城市对内（其他微服务访问）的接口列表
 */
@RestController
@RequestMapping("/city")
public class CityController {

    @Autowired
    private ICtiyService cityService;

    /**
     * 查询城市列表
     * @return
     */
    @RequestMapping("/list")
    public List<City> queryCityList(){
        return cityService.list();
    }

    /**
     * 添加城市
     * @return
     */
    @RequestMapping("/insert")
    public int insertCity(@RequestBody City city){
        return cityService.insert(city);
    }

    /**
     * 修改城市的酒店数量
     * @return
     */
    @RequestMapping("/updateHotalNumber")
    public int updateCityHotalNumber(@RequestParam Integer cid, @RequestParam Integer number){
        return cityService.updateHotalNumber(cid, number);
    }
}
